<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
  <title>A Special Note for Boost 1.52.0 and Higher</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="icon" href="/favicon.ico" type="image/ico" />
  <link rel="stylesheet" type="text/css" href="/style-v2/section-boost.css" />

  <!--[if IE 7]> <style type="text/css"> body { behavior: url(/style-v2/csshover3.htc); } </style> <![endif]-->
</head>
<!-- Don't edit this page! It's generated by site-tools/site-tools.py -->
<body>
  <div id="heading">
    <!--#include virtual="/common/heading.html" -->  </div>

  <div id="body">
    <div id="body-inner">
      <div id="content">
        <div class="section" id="intro">
          <div class="section-0">
            <div class="section-title">
              <h1>A Special Note for Boost 1.52.0 and Higher</h1>
            </div>

            <div class="section-body">
              <h2><span class=
              "news-title">A Special Note for Boost 1.52.0 and Higher</span></h2>

              <p><span class=news-date">November 6th, 2012 09:27 GMT</span></p>


              <div class="news-description">
                <div class="description">


  <p>
    Starting with Boost 1.52.0, the <code><span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span></code>
    component defaults to an implementation that uses the C++11 <code><span class="keyword">decltype</span></code>
    keyword to deduce the return type of callables on compilers with strong <code><span class="keyword">decltype</span></code> support. As <code><span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span></code>
    is a key piece of library infrastructure, we at Boost have found this change
    to be moderately disruptive. You should be aware of the issue when making the
    decision to upgrade from an older version of Boost.
  </p>
  <div id="a_special_note_for_boost_1_52_0_and_higher.why_the_change_was_made">
    <h3><span class="link">Why
    the Change Was Made</span></h3>
    <p>
      <code><span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span></code> has been changed to use <code><span class="keyword">decltype</span></code> to make it more consistent with <code><span class="identifier">std</span><span class="special">::</span><span class="identifier">result_of</span></code>
      (when sufficient compiler support is available). Also, the use of <code><span class="keyword">decltype</span></code> should help to improve compile times
      and increase the accuracy of the type computation.
    </p>
  </div>
  <div id="a_special_note_for_boost_1_52_0_and_higher.who_is_affected">
    <h3><span class="link">Who
    is Affected</span></h3>
    <p>
      If you use a compiler with sufficiently bug-free <code><span class="keyword">decltype</span></code>
      support (including <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3276.pdf">N3276</a>),
      then you will get the new behavior. At the time of writing (Nov 4, 2012), the
      only compiler in that category is Clang 3.1, but as other compilers improve,
      this will change.
    </p>
  </div>
  <div id="a_special_note_for_boost_1_52_0_and_higher.what_problems_can_the_change_cause_">
    <h3><span class="link">What
    Problems Can the Change Cause?</span></h3>
    <p>
      The use of <code><span class="keyword">decltype</span></code> in <code><span class="identifier">result_of</span></code> can result in a different type
      being computed than with the now-obsolete TR1 <code><span class="identifier">result_of</span></code>
      protocol. This will often be the case for incorrectly written TR1-style function
      objects that misreport their result types. This is unfortunately too common.
      But it can even happen for some correctly written function objects.
    </p>
  </div>
  <div id="a_special_note_for_boost_1_52_0_and_higher.where_can_i_learn_more_">
    <h3><span class="link">Where
    Can I Learn More?</span></h3>
    <p>
      Please see the documentation for <a href="https://www.boost.org/doc/libs/1_52_0/libs/utility/utility.htm#result_of"><code><span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span></code></a>
      to understand the differences between TR1 <code><span class="identifier">result_of</span></code>
      and <code><span class="keyword">decltype</span></code> <code><span class="identifier">result_of</span></code>,
      and to find out how you can write your code to accommodate both.
    </p>
  </div>
</div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div id="sidebar">
        <!--#include virtual="/common/sidebar-common.html" --><!--#include virtual="/common/sidebar-boost.html" -->      </div>

      <div class="clear"></div>
    </div>
  </div>

  <div id="footer">
    <div id="footer-left">
      <div id="copyright">
        <p>Copyright Rene Rivera 2006-2007.</p>
      </div><!--#include virtual="/common/footer-license.html" -->    </div>

    <div id="footer-right">
      <!--#include virtual="/common/footer-banners.html" -->    </div>

    <div class="clear"></div>
  </div>
</body>
</html>
